package com.hangjiang.gulidear.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * Baseline entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "baseline", catalog = "sqm")
public class BaseLine extends BaseEntity {

	// Fields

	private String blineId;
	private Project project;
	private String blineDescribe;
	private Set<ConfigItem> configitems = new HashSet<ConfigItem>(0);

	// Constructors

	/** default constructor */
	public BaseLine() {
	}

	/** full constructor */
	public BaseLine(Project project, String blineDescribe) {
		this.project = project;
		this.blineDescribe = blineDescribe;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "bLineId", unique = true, nullable = false, length = 32)
	public String getBlineId() {
		return this.blineId;
	}

	public void setBlineId(String blineId) {
		this.blineId = blineId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "projId")
	public Project getProject() {
		return this.project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	@Column(name = "bLineDescribe")
	public String getBlineDescribe() {
		return this.blineDescribe;
	}

	public void setBlineDescribe(String blineDescribe) {
		this.blineDescribe = blineDescribe;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "baselines")
	public Set<ConfigItem> getConfigitems() {
		return this.configitems;
	}

	public void setConfigitems(Set<ConfigItem> configitems) {
		this.configitems = configitems;
	}

}